package com.csun.cmny.provider.utils;

import com.csun.cmny.base.enums.ErrorCodeEnum;
import com.csun.cmny.provider.exceptions.OmcBizException;
import com.csun.cmny.util.wrapper.WrapMapper;
import com.csun.cmny.util.wrapper.Wrapper;

public class OldManStatusUtils {

    public static String toRelation(Integer type){
        switch (type){
            case 1:
                return "子女";
            case 2:
                return "兄弟姐妹";
            case 3:
                return "旁系亲属";
            case 4:
                return "朋友";
            case 5:
                return "其他";
        }
        return "";
    }

    public static String toStatus(Integer type){
        switch (type){
            case 0:
                return "未入院";
            case 1:
                return "待评估";
            case 2:
                return "待缴费";
            case 3:
                return "已入院";
            case 4:
                return "已出院";
            case 5:
                return "试入住";
            case 6:
                return "去世";
            case 7:
                return "请假中";
            case 8:
                return "调房调级中";
            case 9:
                return "出院中";
            case 10:
                return "app用户" ;
            case 11:
                return "已初评";
            case 12:
                return "待审批";
        }
        return "";
    }

    public static Integer toMStatus(String mStatus) {
        if (mStatus.equals("未婚")){
            return 1;
        }else if (mStatus.equals("已婚")){
            return 2;
        }else if (mStatus.equals("丧偶")){
            return 3;
        }else if (mStatus.equals("离异")){
            return 4;
        }else if (mStatus.equals("未说明婚姻状况")){
            return 5;
        }

        throw new OmcBizException(ErrorCodeEnum.OMC10080100);
    }

    public static Long toPeopleType(String serviceType){
        if (serviceType.equals("政府供养特困对象")){
            return 123l;
        }else if (serviceType.equals("困境家庭保障对象")){
            return 124l;
        }else if (serviceType.equals("优待家庭保障对象")){
            return 125l;
        }else if (serviceType.equals("失独老人")){
            return 126l;
        }else if (serviceType.equals("社会代养")){
            return 127l;
        }else if (serviceType.equals("其他类别老人")){
            return 128l;
        }

        throw new OmcBizException(ErrorCodeEnum.OMC10080105);
    }

    public static Integer toOldEctLelByString(String oldEctLel) {
        if (oldEctLel.equals("无")){
            return 1;
        }else if (oldEctLel.equals("文盲")){
            return 2;
        }else if (oldEctLel.equals("小学")){
            return 3;
        }else if (oldEctLel.equals("初中")){
            return 4;
        }else if (oldEctLel.equals("高中")){
            return 5;
        }else if (oldEctLel.equals("大专及以上")){
            return 6;
        }

        throw new OmcBizException(ErrorCodeEnum.OMC10080101);
    }

    public static Integer toEconomicSourceByString(String economicSource) {
        if (economicSource.equals("无")){
            return 1;
        }else if (economicSource.equals("低保")){
            return 2;
        }else if (economicSource.equals("低保边缘户")){
            return 3;
        }else if (economicSource.equals("退休金/养老金")){
            return 4;
        }else if (economicSource.equals("子女补贴")){
            return 5;
        }else if (economicSource.equals("亲友资助")){
            return 6;
        }

        throw new OmcBizException(ErrorCodeEnum.OMC10080102);
    }

    public static Integer toRelationshipaByString(String relationshipa) {
        if (relationshipa.equals("子女")){
            return 1;
        }else if (relationshipa.equals("兄弟姐妹")){
            return 2;
        }else if (relationshipa.equals("旁系亲属")){
            return 3;
        }else if (relationshipa.equals("朋友")){
            return 4;
        }else if (relationshipa.equals("其他")){
            return 5;
        }
        throw new OmcBizException(ErrorCodeEnum.OMC10080103);
    }

    public static Integer toSexByString(String gender) {
        if (gender.equals("男")){
            return 0;
        }else if (gender.equals("女")){
            return 1;
        }

        throw new OmcBizException(ErrorCodeEnum.OMC10080104);
    }

    public static Integer toKeepByString(String gender) {
        if (gender.equals("否")){
            return 0;
        }else if (gender.equals("是")){
            return 1;
        }

        throw new OmcBizException(ErrorCodeEnum.OMC10080105);
    }

    public static Integer toLimitByString(String gender) {
        if (gender.equals("否")){
            return 0;
        }else if (gender.equals("是")){
            return 1;
        }

        throw new OmcBizException(ErrorCodeEnum.OMC10080105);
    }

    public static Integer toDonateByString(String gender) {
        if (gender.equals("否")){
            return 0;
        }else if (gender.equals("是")){
            return 1;
        }

        throw new OmcBizException(ErrorCodeEnum.OMC10080105);
    }

    public static Integer toOutByString(String gender) {
        if (gender.equals("否")){
            return 0;
        }else if (gender.equals("是")){
            return 1;
        }

        throw new OmcBizException(ErrorCodeEnum.OMC10080105);
    }

    public static Integer toTreatByString(String gender) {
        if (gender.equals("否")){
            return 0;
        }else if (gender.equals("是")){
            return 1;
        }else if (gender.equals("生病通知")){
            return 2;
        }

        throw new OmcBizException(ErrorCodeEnum.OMC10080105);
    }

    public static Integer toNoisyByString(String gender) {
        if (gender.equals("否")){
            return 0;
        }else if (gender.equals("是")){
            return 1;
        }

        throw new OmcBizException(ErrorCodeEnum.OMC10080105);
    }

    public static Integer toRelationByString(String gender) {
        if (gender.equals("夫妻")){
            return 0;
        }else if (gender.equals("子女")){
            return 1;
        }else if (gender.equals("兄弟姐妹")){
            return 2;
        }else if (gender.equals("旁系亲属")){
            return 3;
        }else if (gender.equals("朋友")){
            return 4;
        }else if (gender.equals("其他")){
            return 5;
        }

        throw new OmcBizException(ErrorCodeEnum.OMC10080105);
    }


    //根据身份证号计算生日
    public static String toBirthdatByIdCard(String idCard) {
        String years = idCard.substring(6, 10);
        String month = idCard.substring(10, 12);
        String day = idCard.substring(12, 14);
        String birthdat=years+"-"+month+"-"+day;

        return birthdat;
    }

    public static String toServiceType(Integer serviceType) {
        if (serviceType==1){
            return "居家";
        }
        if (serviceType==2){
            return "入院";
        }
        return "";
    }

    public static Integer toIsDisabled(String isDisabled) {
        if (isDisabled.equals("否")){
            return 0;
        }else if (isDisabled.equals("是")){
            return 1;
        }
        throw new OmcBizException(ErrorCodeEnum.OMC10080105);
    }

}
